package sol.leetcode;

/**
 * H-Index II
 */
public class Issue275 {
    public int hIndex(int[] citations) {
        int h = 0;
        while (h < citations.length && citations[citations.length - 1 - h] > h)
            h++;

        return h;
    }

    public static void main(String[] args) {
        int[] citations = {1, 3, 4, 5, 7, 9};
        Issue275 sol = new Issue275();
        System.out.println(sol.hIndex(citations));
    }
}
